<template>
  <div id="chartLine" :style="{ width: '100%', height: '100%' }"></div>
</template>

<script>
export default {
  data() {
    return {
      chartOption: {
        title: {
          text: '2020年终端套利增量分析（单位：百万人）',
          left: 'center'
        },
        xAxis: {
          type: 'category',
          data: ['1月', '2月', '3月', '4月', '5月', '6月', '7月', '8月']
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: [0.2, 0.6, 0.9, 1.1, 0.7, 0.3, 0.8, 0.4],
            type: 'line',
            symbol: 'triangle',
            smooth: true,
            symbolSize: 10,
            lineStyle: {
              color: 'green',
              width: 4,
              type: 'dashed'
            },
            itemStyle: {
              borderWidth: 3,
              borderColor: 'yellow',
              color: 'blue'
            }
          }
        ]
      }
    }
  },

  mounted() {
    this.drawLine()
  },

  methods: {
    drawLine() {
      // 基于准备好的dom，初始化echarts实例
      let myChart = this.$echarts.init(document.getElementById('chartLine'))
      // 绘制图表
      myChart.setOption(this.chartOption)
    }
  }
}
</script>

<style lang="scss" scoped></style>
